package com.banksystem.service.impl;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.banksystem.entity.News;
import com.banksystem.mapper.Newsmapper;
import com.banksystem.service.Newsservice;
@Service
public class newsserviceimpl implements Newsservice {

	@Autowired
	private Newsmapper mapper;
	
	@Override
	public void addnews(String title,String gname,String master ,String content) {
		// TODO Auto-generated method stub
		mapper.addnews(title,gname,master,content,date());
	}
	
	public String date() {
		SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd");
		return sdf.format(new Date());
	}

	@Override
	public List<News> findNewsAll(String gname) {
		
		return mapper.findNewsAll(gname);
	}

	@Override
	public void deletenews(String nid) {
		mapper.deletenews(nid);
		
	}

	@Override
	public List<News> findNewsAlllike(String seach,String gname) {
		// TODO Auto-generated method stub
		return mapper.findNewsAlllike(seach,gname);
	}

	@Override
	public List<News> adminfindNewsAll() {
		// TODO Auto-generated method stub
		return mapper.adminfindNewsAll();
	}

}
